package com.itheima.order.controller;

import com.itheima.common.pojo.Order;
import com.itheima.common.vo.OrderVO;
import com.itheima.order.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;
import java.util.List;

@RestController
@RequestMapping("/order")
public class OrderController {

    @Autowired
    private OrderService orderService;

    @GetMapping("/query")
    public List<OrderVO> findOrderByUsername(@RequestParam("username") String username) throws InterruptedException {

        System.out.println("访问时间:"+new Date());

        List<OrderVO> orders=orderService.findOrderByUsername(username);
        return orders;
    }

}
